﻿// Original author contact info: Owen Emlen (owene_1998@yahoo.com)
// Note: other individuals may also have contributed to this code
// Project hosted on CodePlex.com as of 1/10/2009 at http://wpfimageviewer.codeplex.com
using System;
using System.Windows;
using BrainTechLLC;

namespace BrainTechLLC.WPF
{
#if SILVERLIGHT
#else

    public abstract class WindowHandlerBase<TWindow, TViewModel> : BaseNotifyPropertyChanged
        where TWindow : Window
        where TViewModel : class
    {
        public event EventHandler Closed;
        protected Window _parentWindow;
        public TWindow _window;
        public bool _windowClosed;
        protected bool _windowDockableAttached;
        protected bool _windowDocumentAttached;

        public virtual Window ParentWindow
        {
            get { return _parentWindow; }
        }

        public virtual TWindow Window
        {
            get { return _window; }
        }

        public WindowHandlerBase(Window parentWindow)
        {
            _parentWindow = parentWindow;
        }

        public virtual void Close()
        {
            if (_window != null)
            {
                _window.Close();
            }
        }

        public abstract void OpenWindow(TViewModel vm);
    }
#endif
}
